<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>切角效果</title>
    <link rel="stylesheet" href="../public.css">
    <style>
        .box {
            width: 120px;
            height: 80px;
            margin: 20px auto;
            background-color: green;
        }

        .cornerCut {
            background: #58a;
            background:
                linear-gradient(135deg, transparent 15px, #58a 0) top left,
                linear-gradient(-135deg, transparent 15px, #58a 0) top right,
                linear-gradient(-45deg, transparent 15px, #58a 0) bottom right,
                linear-gradient(45deg, transparent 15px, #58a 0) bottom left;
            background-size: 50% 50%;
            background-repeat: no-repeat;
        }

        .cornerCut1 {
            background: #58a;
            background:
                radial-gradient(circle at top left,
                    transparent 15px, #58a 0) top left,
                radial-gradient(circle at top right,
                    transparent 15px, #58a 0) top right,
                radial-gradient(circle at bottom right,
                    transparent 15px, #58a 0) bottom right,
                radial-gradient(circle at bottom left,
                    transparent 15px, #58a 0) bottom left;
            background-size: 50% 50%;
            background-repeat: no-repeat;
        }

        .cornerCut2 {
            background: #58a;
            clip-path: polygon(20px 0, calc(100% - 20px) 0, 100% 20px,
                    100% calc(100% - 20px), calc(100% - 20px) 100%,
                    20px 100%, 0 calc(100% - 20px), 0 20px);
        }
    </style>
</head>

<body>
    <div class="content">
        <h1>基于变形的方案</h1>
        <ul>
            <li>通过渐变可以接受一个角度（45deg）作为方向</li>
            <li>使用 background-size 让每层渐变分别只占据整个元素一半的面积。</li>
            <li> background-repeat 关掉了,</li>
        </ul>
        <div class="box cornerCut ">
        </div>
        <div class="box cornerCut1 ">
        </div>
    </div>
    <div class="content">
        <h1>裁切路径方案</h1>
        <ul>

        </ul>
        <div class="box cornerCut2 ">
        </div>
    </div>
</body>

</html>